<?php

use think\facade\Route;

// api接口无需token模块
Route::group('coach', function () {
    // 通用模块
    Route::group('index', function () {
        Route::any('index', 'coach.Index/index')->name('首页');
        Route::any('getAppId', 'coach.Index/getAppId')->name('公众号ID');
    });
    Route::group('user', function () {
        Route::any('login', 'coach.User/login')->name('登录');
    });
    Route::group('notify', function () {
        Route::any('settlement', 'coach.Notify/settlement')->name('支付回调');
    });
    Route::group('sms', function () {
        Route::any('sendSms', 'coach.Sms/sendSms')->name('发送短信');
    });
})->allowCrossDomain();

// api接口模块
Route::group('coach', function () {
    Route::group('user', function () {
        Route::any('getUserInfo', 'coach.User/getUserInfo')->name('用户信息');
        Route::any('getTeamInfo', 'coach.User/getTeamInfo')->name('团队信息');
        Route::any('getConversionRatio', 'coach.User/getConversionRatio')->name('转化率');
        Route::any('wxScope', 'coach.User/wxScope')->name('授权登录');
        Route::any('withdraw', 'coach.User/withdraw')->name('提现');
        Route::any('getMoneyRecord', 'coach.User/getMoneyRecord')->name('钱包明细');
        Route::any('getUserQrcode', 'coach.User/getUserQrcode')->name('分享二维码');
        Route::any('evaluate', 'coach.User/evaluate')->name('学员评价');
        Route::any('getTeamUser', 'coach.User/getTeamUser')->name('团队成员信息');
        Route::any('getTeamUserList', 'coach.User/getTeamUserList')->name('团队成员列表');
        Route::any('getInviteUserList', 'coach.User/getInviteUserList')->name('邀请列表');
    });
    Route::group('order', function () {
        Route::any('getInfo', 'coach.Order/getInfo')->name('抢单信息');
        Route::any('getRobOrderList', 'coach.Order/getRobOrderList')->name('抢单列表');
        Route::any('acceptOrder', 'coach.Order/acceptOrder')->name('抢单');
        Route::any('getHistoryOrderList', 'coach.Order/getHistoryOrderList')->name('历史订单');
        Route::any('getOrderList', 'coach.Order/getOrderList')->name('教学订单');
        Route::any('getOrderTotalAmount', 'coach.Order/getOrderTotalAmount')->name('结款金额');
        Route::any('getCoachList', 'coach.Order/getCoachList')->name('教练列表');
        Route::any('designCoach', 'coach.Order/designCoach')->name('指派教练');
        Route::any('completeOrder', 'coach.Order/completeOrder')->name('完成订单');
        Route::any('createCoach', 'coach.Order/createCoach')->name('创建教练');
        Route::any('getAuthList', 'coach.Order/getAuthList')->name('待认证列表');
        Route::any('refuse', 'coach.Order/refuse')->name('拒绝邀请');
        Route::any('accept', 'coach.Order/accept')->name('接受邀请');
        Route::any('pay', 'coach.Order/pay')->name('缴纳保证金');
        Route::any('getOrderDetail', 'coach.Order/getOrderDetail')->name('订单详情');
        Route::any('confirmProgress', 'coach.Order/confirmProgress')->name('进度确认');
        Route::any('complete', 'coach.Order/complete')->name('教练完成微信支付');
        Route::any('designCoach', 'coach.Order/designCoach')->name('指派教练');
        Route::any('confirmOrder', 'coach.Order/confirmOrder')->name('教练确认到场');
    });
    Route::group('index', function () {
        Route::any('getAgreement', 'coach.Index/getAgreement')->name('获取协议');
    });

    Route::group('file', function () {
        Route::any('upload', 'coach.File/upload')->name('文件上传');
    });
})->allowCrossDomain()->middleware('coach_auth');
